﻿<%@ Assembly Name="MII_FIF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f02eab3637bedb94" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register Src="../../../../_controltemplates/15/MII_FIF/Header.ascx" TagPrefix="UC" TagName="Header" %>
<%@ Register Src="../../../../_controltemplates/15/MII_FIF/LeftMenu.ascx" TagPrefix="UC" TagName="LeftMenu" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FormWorkOrder.aspx.cs" Inherits="MII_FIF.Layouts.MII_FIF.FormWorkOrder" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <link href="../JQuery/jquery-ui-1.10.3.custom/css/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
    <link href="../Style.css" rel="stylesheet" type="text/css" />
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">    
    <script src="../JQuery/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="../JQuery/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>    
    <script src="../JQuery/jquery-ui-1.10.3.custom/js/jquery.numeric.js" type="text/javascript"></script>    
    <script type="text/javascript">
        function MyDatePickerInit() {
            $('.DatePicker').datepicker({
                dateFormat: 'd M yy', changeMonth: true, changeYear: true, yearRange: "c-100:c+100",
                monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
            });
            $(".DatePicker").attr('readonly', true);
        }

        function NumberOnlyInit() {
            $(".numeric").numeric();
            $(".integer").numeric(false, function () { alert("Integers only"); this.value = ""; this.focus(); });
            $(".positive").numeric({ negative: false }, function () { alert("No negative values"); this.value = ""; this.focus(); });
            $(".positive-integer").numeric({ decimal: false, negative: false }, function () { alert("Positive integers only"); this.value = ""; this.focus(); });
            $("#remove").click(
                    function (e) {
                        e.preventDefault();
                        $(".numeric,.integer,.positive").removeNumeric();
                    }
            );
        }

        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_endRequest(EndRequest);
        function EndRequest(sender, args) {
            MyDatePickerInit();
        }

        $(function () {
            MyDatePickerInit();
            NumberOnlyInit();
        });
        
        function CheckTheCheckBoxes(dename) {
            var deid = "";
            var elem = document.forms[0].elements;
            for (var i = 0; i < elem.length; i++) {
                if (elem[i].name != null) {
                    if (elem[i].name.indexOf(dename) != -1) {
                        if (elem[i].disabled == false) {
                            elem[i].checked = document.getElementById('chkSelectAll').checked;
                        }
                    }
                }
            }
            return deid;
        }
    </script>
    <asp:Panel ID="Panel2" runat="server" DefaultButton="btnSubmit">
        <table class="TableLuar">
            <tr>
                <td class="LeftMenu">
                    <UC:LeftMenu runat="server" id="LeftMenu" />
                </td>
                <td style="vertical-align: top;">
                    <table class="TableDalam">
                        <tr>
                            <td colspan="4">
                                <UC:Header runat="server" ID="Header"></UC:Header>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Work order No.</td>
                            <td colspan="3">
                                <asp:TextBox runat="server" ID="txtWorkOrderNo" CssClass="numeric"></asp:TextBox>
                                <asp:Label ID="Label5" runat="server" CssClass="errorMsg" Text="*"/>
                                <asp:RequiredFieldValidator ID="rfvWorkOrderNo" Display="Dynamic" runat="server" ControlToValidate="txtWorkOrderNo" ErrorMessage="Please input Work Order No" CssClass="errorMsg" SetFocusOnError="true"/>
                            </td>     
                        </tr>
                        <tr>
                            <td class="KolomKiri">Tanggal</td>
                            <td colspan="3">
                                <asp:TextBox runat="server" ID="txtTanggal" CssClass="DatePicker"></asp:TextBox>
                                <asp:Label ID="Label2" runat="server" CssClass="errorMsg" Text="*"/>
                                <asp:RequiredFieldValidator ID="rfvTanggal" Display="Dynamic" runat="server" ControlToValidate="txtTanggal" ErrorMessage="Please select Date" CssClass="errorMsg" SetFocusOnError="true"/>
                            </td>   
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:Panel runat="server" ID="pnlType">
                                    <hr />
                                </asp:Panel>
                                <h2>Type of Equipment</h2>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Label Name</td>
                            <td colspan="3">
                                <asp:DropDownList runat="server" ID="ddlLabelName" OnSelectedIndexChanged="ddlLabelName_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                                <asp:Label ID="Label1" runat="server" CssClass="errorMsg" Text="*"/>
                                <asp:RequiredFieldValidator ID="rfvLabelName" InitialValue="-1"  Display="Dynamic" runat="server" ControlToValidate="ddlLabelName" ErrorMessage="Please select label name" CssClass="errorMsg" SetFocusOnError="true"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Brand</td>
                            <td colspan="3">
                                <asp:Label runat="server" ID="lblBrand"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Category</td>
                            <td colspan="3">
                                <asp:Label runat="server" ID="lblCategory"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">SN</td>
                            <td colspan="3">
                                <asp:Label runat="server" ID="lblSN"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Vendor</td>
                            <td colspan="3">
                                <asp:DropDownList runat="server" ID="ddlVendor" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Name</td>
                            <td colspan="3">
                                <asp:TextBox runat="server" ID="txtVendorName" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">PIC</td>
                            <td colspan="3">
                                <asp:Label runat="server" ID="lblPIC"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:Panel runat="server" ID="Panel1">
                                    <hr />
                                </asp:Panel>
                                <h2>Desc. of Request for Service : </h2>
                                *note check the box if yes
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">System Configuration</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkSystemConfiguration" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Troubleshooting</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkTroubleshooting" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Hardware/Software Installation</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkHardware" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Data Backup/Recovery</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkDataBackup" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Software Update</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkSoftwareUpdate" />
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Upgrade Firmware</td>
                            <td colspan="3">
                                <asp:CheckBox runat="server" ID="chkUpgrade" />
                            </td>
                        </tr>  
                         <tr>
                            <td colspan="4">
                                <asp:Panel runat="server" ID="pnlDescription">
                                    <hr />
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                Brief description of work performed
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:TextBox runat="server" ID="txtDescription" TextMode="MultiLine" Width="100%" Height="100px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                Note
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:TextBox runat="server" ID="txtNote" TextMode="MultiLine" Width="100%" Height="100px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">Start Date</td>
                            <td colspan="3">
                                <asp:TextBox runat="server" ID="txtStartDate" CssClass="DatePicker"></asp:TextBox>
                                <asp:Label ID="Label3" runat="server" CssClass="errorMsg" Text="*"/>
                                <asp:RequiredFieldValidator ID="rfvStartDate" Display="Dynamic" runat="server" ControlToValidate="txtStartDate" ErrorMessage="Please select Start Date" CssClass="errorMsg" SetFocusOnError="true"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="KolomKiri">End Date</td>
                            <td colspan="3">
                                <asp:TextBox runat="server" ID="txtFinishDate" CssClass="DatePicker"></asp:TextBox>
                                <asp:Label ID="Label4" runat="server" CssClass="errorMsg" Text="*"/>
                                <asp:RequiredFieldValidator ID="rfvFinishDate" Display="Dynamic" runat="server" ControlToValidate="txtFinishDate" ErrorMessage="Please select Finish Date" CssClass="errorMsg" SetFocusOnError="true"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:Panel ID="pnlModulDetail" runat="server" GroupingText="Request equipment to be picked up">
                                    <table style="width: 100%;">
                                        <tr>
                                            <td width="190px">Item
                                            </td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtItem"></asp:TextBox>
                                            </td>
                                            <td width="190px">Quantity
                                            </td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtQuantity" CssClass="numeric" ></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="190px">Serial Number
                                            </td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtSerialNumber"></asp:TextBox>
                                            </td>
                                            <td width="190px">Accessories
                                            </td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtAccessories"></asp:TextBox>
                                            </td>
                                        </tr>                                       
                                        <tr>
                                            <td colspan="4">
                                                <asp:Button runat="server" ID="btnAdd" Text="Add" OnClick="btnAdd_Click" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="4">
                                                <asp:GridView runat="server" ID="GridItem" AutoGenerateColumns="false" 
                                                    OnPageIndexChanging="GridItem_PageIndexChanging" OnRowUpdating="GridItem_RowUpdating" OnRowCancelingEdit="GridItem_RowCancelingEdit" OnRowEditing="GridItem_RowEditing" CssClass="grid">
                                                    <EmptyDataTemplate>
                                                        Data Kosong
                                                    </EmptyDataTemplate>
                                                    <Columns>
                                                        <asp:TemplateField>
                                                            <HeaderTemplate>
                                                                <input type="checkbox" name="chkSelectAll" id="chkSelectAll" onclick="CheckTheCheckBoxes('chk');" />
                                                            </HeaderTemplate>
                                                            <ItemTemplate>
                                                                <asp:CheckBox runat="server" ID="chk" />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Item">
                                                            <ItemTemplate>
                                                                <asp:TextBox runat="server" ID="lblItem" Text='<%# Bind("[Item]") %>' ReadOnly="true"></asp:TextBox>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox runat="server" ID="txtItem" Text='<%# Bind("[Item]") %>'></asp:TextBox>
                                                            </EditItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Quantity">
                                                            <ItemTemplate>
                                                                <asp:TextBox runat="server" ID="lblQuantity" Text='<%# Bind("[Quantity]") %>' ReadOnly="true"></asp:TextBox>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox runat="server" ID="txtQuantity" Text='<%# Bind("[Quantity]") %>'></asp:TextBox>
                                                            </EditItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Serial Number">
                                                            <ItemTemplate>
                                                                <asp:TextBox runat="server" ID="lblSerialNumber" Text='<%# Bind("[SerialNumber]") %>' ReadOnly="true"></asp:TextBox>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox runat="server" ID="txtSerialNumber" Text='<%# Bind("[SerialNumber]") %>'></asp:TextBox>
                                                            </EditItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Accessories">
                                                            <ItemTemplate>
                                                                <asp:TextBox runat="server" ID="lblAccessories" Text='<%# Bind("[Accessories]") %>' ReadOnly="true"></asp:TextBox>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox runat="server" ID="txtAccessories" Text='<%# Bind("[Accessories]") %>'></asp:TextBox>
                                                            </EditItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:BoundField DataField="ID" HeaderStyle-CssClass="hidden" ItemStyle-CssClass="hidden"
                                                            FooterStyle-CssClass="hidden" />
                                                        <asp:TemplateField HeaderText="Action">
                                                            <ItemTemplate>
                                                                <asp:Button runat="server" ID="btnEdit" Text="Edit" CommandName="Edit" />
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <table>
                                                                    <tr>
                                                                        <td>
                                                                            <asp:Button runat="server" ID="btnSave" Text="Save" CommandName="Update" />
                                                                        </td>
                                                                        <td>
                                                                            <asp:Button runat="server" ID="btncancel" Text="Cancel" CommandName="Cancel" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </EditItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                </asp:GridView>
                                                <br />
                                                <br />
                                                <asp:Button runat="server" ID="btnDelete" Text="Delete" OnClick="btnDelete_Click" />
                                            </td>
                                        </tr>                                        
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>                       
                        <tr>
                            <td class="KolomKiri">Attachment</td>
                            <td colspan="3">
                                <asp:FileUpload runat="server" ID="FUAttachment" />
                                <asp:Label runat="server" ID="lblFileName" />
                                <asp:Button runat="server" ID="btnDownload" Text="Download" OnClientClick="download();" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <asp:Label runat="server" ID="lblerror" CssClass="errorMsg"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" align="center">
                                <asp:Button runat="server" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" />
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="btnCancel_Click" CausesValidation="false"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Form Work Order
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">    
</asp:Content>
